package com.wq.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wq.entity.Category;
import com.wq.mapper.CategoryMapper;
import com.wq.service.CategoryService;
import com.wq.vo.CategoryListVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {

    public List<CategoryListVO> selectList() {
        List<Category> list=this.list();
        List<CategoryListVO> categoryVOList=new ArrayList<>();
        for (Category category:list){
            CategoryListVO categoryVO=new CategoryListVO();
            categoryVO.setLabel(category.getName());
            categoryVO.setValue(category.getId());
            categoryVOList.add(categoryVO);
        }

        return categoryVOList;

    }
}
